package com.umakr.ax.app.web;

import java.util.Map;

import com.umakr.ax.opt.service.RadioStationOptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import com.umakr.ax.common.model.RadioStation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import com.umakr.ax.core.base.AbstractController;

/**
 * <p>
 * 电台信息  前端控制器
 * </p>
 *
 * @author Umakr-Code-Generator
 * @since 2017-12-30
 */
@Controller
@RequestMapping("/api/web/radioStation")
public class RadioStationWebController extends AbstractController {

	@Autowired
	RadioStationOptService radioStationOptService;

	@Override
	@ApiOperation(value = "查询电台信息")
	@PutMapping(value = "/read/list")
	public Object query(ModelMap modelMap, @RequestBody Map<String, Object> param) {
		return super.query(modelMap, param);
	}

	@ApiOperation(value = "电台信息详情")
	@PutMapping(value = "/read/detail")
	public Object get(ModelMap modelMap, @RequestBody RadioStation param) {
		return super.get(modelMap, param);
	}

	@PostMapping
	@ApiOperation(value = "修改电台信息")
	public Object update(ModelMap modelMap, @RequestBody RadioStation param) {
		return super.update(modelMap, param);
	}

	@DeleteMapping
	@ApiOperation(value = "删除电台信息")
	public Object delete(ModelMap modelMap, @RequestBody RadioStation param) {
		return super.delete(modelMap, param);
	}

	@ApiOperation(value = "电台详情")
	@GetMapping(value = "/getRadioStationByRsId")
	@ResponseBody
	public Object getRadioStationByRsId(ModelMap modelMap,@RequestParam(name = "rsId") Long rsId) {
		return setSuccessModelMap(modelMap,radioStationOptService.getRadioStationByRsId(rsId));
	}

	@ApiOperation(value = "新增或者更新电台")
	@GetMapping("/saveOrUpdateRadioStation")
	@ResponseBody
	public Object saveOrUpdateRadioStation(ModelMap modelMap,RadioStation radioStation,String username,String password) {
		return setSuccessModelMap(modelMap,radioStationOptService.saveOrUpdateRadioStation(radioStation,username,password));
	}
}